#include "GSDuelSelect.h"
#include "GSBattleMode.h"

GSDuelSelect::GSDuelSelect()
{
	SetStateName("GSDUELSELECT");
}

GSDuelSelect::~GSDuelSelect()
{
	
}

void GSDuelSelect::OnEnter()
{
	fontCustom = Game::GetDevice()->GetInstance()->getGUIEnvironment()->getFont("data/strings/fontcourier.bmp");
}

void GSDuelSelect::OnExit()
{

}

void GSDuelSelect::Update()
{
	if(Game::GetDevice()->receiver.IsKeyUp(KEY_KEY_1))
	{
		Game::GetInstance()->GenerateAIPlayer("ENEMY", 0, RANK_A);
		Game::SetState((GameState*)new GSBattleMode());
	}
	else if(Game::GetDevice()->receiver.IsKeyUp(KEY_KEY_2))
	{
		Game::GetInstance()->GenerateAIPlayer("ENEMY", 0, RANK_B);
		Game::SetState((GameState*)new GSBattleMode());
	}
	else if(Game::GetDevice()->receiver.IsKeyUp(KEY_KEY_3))
	{
		Game::GetInstance()->GenerateAIPlayer("ENEMY", 0, RANK_C);
		Game::SetState((GameState*)new GSBattleMode());
	}
	else if(Game::GetDevice()->receiver.IsKeyUp(KEY_KEY_4))
	{
		Game::GetInstance()->GenerateAIPlayer("ENEMY", 0, RANK_D);
		Game::SetState((GameState*)new GSBattleMode());
	}
	else if(Game::GetDevice()->receiver.IsKeyUp(KEY_KEY_5))
	{
		Game::GetInstance()->GenerateAIPlayer("ENEMY", 0, RANK_E);
		Game::SetState((GameState*)new GSBattleMode());
	}
	else if(Game::GetDevice()->receiver.IsKeyUp(KEY_KEY_6))
	{
		Game::GetInstance()->GenerateAIPlayer("ENEMY", 0, RANK_F);
		Game::SetState((GameState*)new GSBattleMode());
	}
}

void GSDuelSelect::Render()
{
	Game::GetDevice()->GetDriver()->beginScene(true, true, video::SColor(255,255,255,255));

	fontCustom->draw("SELECT CLASS TO CHALLENGE", core::rect<s32>(SCREEN_WIDTH/2, SCREEN_HEIGHT/2,100,10), video::SColor(255,0,0,0));
	fontCustom->draw("1. Rank A", core::rect<s32>(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 15,100,10), video::SColor(255,0,0,0));
	fontCustom->draw("2. Rank B", core::rect<s32>(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 25,100,10), video::SColor(255,0,0,0));
	fontCustom->draw("3. Rank C", core::rect<s32>(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 35,100,10), video::SColor(255,0,0,0));
	fontCustom->draw("4. Rank D", core::rect<s32>(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 45,100,10), video::SColor(255,0,0,0));
	fontCustom->draw("5. Rank E", core::rect<s32>(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 55,100,10), video::SColor(255,0,0,0));
	fontCustom->draw("6. Rank F", core::rect<s32>(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 65,100,10), video::SColor(255,0,0,0));

	Game::GetDevice()->GetDriver()->endScene();
}